import { createRouter, createWebHistory } from "vue-router"
const routes = [
  {
    path: '/',
    name: 'root',
    redirect: { name: "home" },
    component: () => import("@/layouts/index.vue"),
    children: [{
      path: '/home',
      name: 'home',
      component: () => import('@/views/home/index.vue')
    }]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import("@/views/login/index.vue"),
  },
  {
    path: '/my',
    name: 'my',
    redirect: { name: "info" },
    component: () => import("@/layouts/index.vue"),
    children: [{
      path: 'info',
      name: 'info',
      component: () => import('@/views/my/info/index.vue')
    },
    {
      path: 'avatar',
      name: 'avatar',
      component: () => import('@/views/my/avatar/index.vue')
    },
    {
      path: 'secret',
      name: 'secret',
      component: () => import('@/views/my/secret/index.vue')
    }]
  },
  {
    path: '/article',
    name: 'article',
    redirect: { name: "sort" },
    component: () => import("@/layouts/index.vue"),
    children: [{
      path: 'sort',
      name: 'sort',
      component: () => import('@/views/article/sort/index.vue')
    },
    {
      path: 'list',
      name: 'list',
      component: () => import('@/views/article/list/index.vue')
    },
    {
      path: 'publish',
      name: 'publish',
      component: () => import('@/views/article/publish/index.vue')
    }]
  }
]
const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router